<script setup lang="ts">
import { computed } from 'vue'

//enum 枚举类型用于切换支付方式
enum PayType {
    WECHAT = '微信钱包',
    ALIPAY = '支付宝',
    BANK_CARD = '银行卡',
}
//传递过来的数据格式为
interface Data {
    id: string
    createTime: string
    updateTime: string
    version: number
    deleted: boolean
    msgId: string
    sourceType: string
    no: string
    offline: boolean
    status: string
    ownerType: string
    ownerId: string
    contract: string
    drawType: {
        type: string
        amount: string
        name: string
        bank: string
        cardNo: string
    }
}
const { divTenThousand } = useConvert()
const props = defineProps({
    data: {
        type: Object as () => Data,
        default: () => {
            return {}
        },
    },
    status: {
        type: String,
        default: '待审核',
    },
})
//支付方式
const payType = computed(() => {
    if (props.data.drawType.type === 'WECHAT') {
        return PayType.WECHAT
    } else if (props.data.drawType.type === 'ALIPAY') {
        return PayType.ALIPAY
    } else if (props.data.drawType.type === 'BANK_CARD') {
        return PayType.BANK_CARD
    } else {
        return ''
    }
})
console.log(props.data)
</script>

<template>
    <view class="listItem">
        <view class="listItem__first">{{ props.data?.createTime }}</view>
        <view class="listItem__second">{{ payType }}</view>
        <view class="listItem__third">
            <view class="listItem__third--top">￥{{ divTenThousand(props.data?.drawType.amount) }}</view>
            <view class="listItem__third--bottom">{{ props.status }}</view>
        </view>
    </view>
</template>

<style lang="scss" scoped>
@include b(listItem) {
    display: flex;
    padding: 0 30rpx 0 26rpx;
    align-items: center;
    color: #101010;
    font-size: 26rpx;
    justify-content: space-between;
    margin-bottom: 28rpx;
    @include e(first) {
        font-weight: 600;
        margin-right: 70rpx;
        font-size: 12px;
    }
    @include e(second) {
        font-weight: 300;
        flex: 1;
        // margin-right: 40rpx;
    }
    @include e(third) {
        width: 250rpx;
        text-align: right;
        font-size: 24rpx;
        @include m(top) {
        }
        @include m(bottom) {
        }
    }
}
</style>
